//
//  HomeThemeVC.m
//  IconMaster
//
//  Created by mac on 2017/7/31.
//  Copyright © 2017年 yangweiwei. All rights reserved.
//

#import "HomeThemeVC.h"
#import "HomeTableViewCell.h"
#import "ThemeViewController.h"
@interface HomeThemeVC ()<UITableViewDelegate, UITableViewDataSource>
@property (strong, nonatomic)  UITableView *tableView0;
@end

@implementation HomeThemeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self setImageViewINNav];
    [self setBarType];//
    self.title = self.nameStr;
    
    [self.view addSubview:self.tableView0];
    // Do any additional setup after loading the view.
}
- (UITableView *)tableView0{

    if (!_tableView0) {
        _tableView0 = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, KWidth, KHeight - 64) style:UITableViewStyleGrouped];
        _tableView0.delegate = self;
        _tableView0.dataSource = self;
    }
    return _tableView0;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.themeArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 200*ScreenRatio_Heght;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    HomeTableViewCell *cell = [HomeTableViewCell cellWithTableView:self.tableView0];
//    cell.delegate = self;
    [cell dealWithHomeData:self.themeArr[indexPath.row]];
//    [cell.imgView0 sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@", BaseURLImage,self.themeArr[indexPath.row][@"topPicturePath"]]]];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    HomeModel *model = self.themeArr[indexPath.row];
    ThemeViewController *themeView = [[ThemeViewController alloc] init];
    themeView.themeID = model.stringID;
    [self.navigationController pushViewController:themeView animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
